<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp">
		<script src="../js/lib/mdui.min.js"></script>
		<script src="../js/lib/jquery-3.2.1.slim.min.js"></script>
		<script src="../js/lib/holder.min.js"></script>
		<script src="../js/lib/highlight.pack.js"></script>
		<script src="../js/lib/mustache.js"></script>
		<script src="../js/docs.js"></script>
		<script src="../js/init.js"></script>
		<script src="../js/listfile.js"></script>
		<script src="../js/lib/jquery.media.js"></script>
		<script src="../js/uploadfile.js"></script>
		<script src="../js/components/core-min.js"></script>
		<script src="../js/components/md5-min.js"></script>
		<script src="../js/components/sha256-min.js"></script>
		<script src="../js/hash.js"></script>
		<link rel="stylesheet" href="../css/mdui.min.css">
		<link rel="stylesheet" href="../css/github-gist.css">
		<link rel="stylesheet" href="../css/railscasts.css">
		<link rel="stylesheet" href="../css/docs.css">
		<link rel="stylesheet" href="../css/mdui.min.css" />
		<title>欢迎使用STdisk - 集中管理您的所有文件</title>
	</head>

	<script>
		let data = {
			buttons: [{
					color: "pink",
					content: "上传",
					icon: "cloud_upload",
					event: "onclick='upload()'"
				},
				{
					color: "blue",
					content: "删除",
					icon: "delete",
					event: "onclick='deletfiles()'"
				}
			]
		};

		let PATH = "";

		function upload() {
			let inst = new mdui.Dialog("#uploadFile");
			inst.open();
		}
		$(document).ready(function() {
			jumpto("/");
			initfab(data);
			$("#search-key").keyup(function(event) {
				if(event.keyCode === 13) {
					let key = $("#search-key").val();
					searchfile(key, "all");
				}
			});

		});

		function show_menu() {
			var inst = new mdui.Menu('#file-type', '#filetype');
			inst.toggle();
		}
	</script>

	<body class="mdui-drawer-body-left mdui-appbar-with-toolbar mdui-theme-accent-pink mdui-loaded mdui-theme-primary-blue">

	<div class="mdui-appbar mdui-appbar-fixed">
		<div class="mdui-toolbar mdui-color-theme">
			<a href="javascript:" class="mdui-btn mdui-btn-icon" mdui-drawer="{target: '#main-drawer'}"><i
					class="mdui-icon material-icons">menu</i></a>
			<a href="../index.html" class="mdui-typo-headline">STdisk</a>

			<div class="mdui-toolbar-spacer"></div>

			<div class="mdui-textfield mdui-textfield-expandable">
				<button class="mdui-textfield-icon mdui-btn mdui-btn-icon" onclick="$('#file-type').toggle() // 打开输入">
					<i class="mdui-icon material-icons">search</i>
				</button>
				<input id="search-key" class="mdui-textfield-input" type="text" placeholder="我们支持正则">
				<a class="mdui-btn" id="file-type" style="position:absolute;top:0;right:27px;display: none"
				   onclick="show_menu()">
					所有文件
				</a>
				<!--这里 mdui-menu 会被 textfield 截断，而放在外面有不会生效...-->
				<ul class="mdui-menu" id="filetype">
					<li class="mdui-menu-item">
						<a href="#" class="mdui-ripple">所有文件</a>
					</li>
					<li class="mdui-menu-item">
						<a href="#" class="mdui-ripple">搜索文档</a>
					</li>
					<li class="mdui-menu-item">
						<a href="#" class="mdui-ripple">搜索代码</a>
					</li>
				</ul>
				<button class="mdui-textfield-close mdui-btn mdui-btn-icon" onclick="$('#file-type').toggle() // 关闭输入">
					<i class="mdui-icon material-icons">close</i>
				</button>
			</div>

			<span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white"
				  mdui-dialog="{target: '#dialog-docs-theme'}" mdui-tooltip="{content: '设置主题'}"><i
					class="mdui-icon material-icons">color_lens</i></span>
			<a id="logout" class="mdui-btn mdui-btn-icon" mdui-tooltip="{content: '登出'}"><i
					class="mdui-icon material-icons">call_missed</i></a>
		</div>
	</div>


		<div class="mdui-drawer" id="main-drawer">
			<ul class="mdui-list" id="choosePage">
				<li class="mdui-list-item mdui-ripple">
					<div class="mdui-list-item-content">我的资料</div>
					<i class="mdui-icon material-icons">person</i>
				</li>
				<div class="mdui-divider"></div>
				<li class="mdui-list-item mdui-ripple mdui-list-item-active">
					<div class="mdui-list-item-content">我的网络硬盘</div>
					<i class="mdui-icon material-icons">insert_drive_file</i>
				</li>
				<li class="mdui-list-item mdui-ripple">
					<div class="mdui-list-item-content">我的共享</div>
					<i class="mdui-icon material-icons">share</i>
				</li>
				<li class="mdui-list-item mdui-ripple">
					<div class="mdui-list-item-content">最近文件</div>
					<i class="mdui-icon material-icons">history</i>
				</li>
				<div class="mdui-divider"></div>
				<li class="mdui-list-item mdui-ripple">
					<div class="mdui-list-item-content">回收站</div>
					<i class="mdui-list-item-icon mdui-icon material-icons">delete</i>
				</li>
			</ul>
		</div>

		<div class="mdui-dialog" id="uploadFile">
			<div class="mdui-tab mdui-tab-full-width">
				<a class="mdui-ripple">上传文件</a>
			</div>
			<div class="mdui-m-b-2">
				<div class="mdui-textfield">
					<i class="mdui-icon material-icons">insert_drive_file</i>
					<input id="choosedfile" class="mdui-textfield-input" type="text" placeholder="请选择要上传的文件" disabled/>
				</div>
				<button id="bupload" class="mdui-btn mdui-color-theme-accent mdui-ripple mdui-col-offset-md-2">上传</button>
				<button id="bchoose" class="mdui-btn mdui-color-theme-accent mdui-ripple mdui-col-offset-md-2" type="file">选择文件...</button>
				<button class="mdui-btn mdui-color-theme-accent mdui-ripple mdui-col-offset-md-2 " mdui-dialog-close>取消</button>
			</div>

		</div>

		<div class="mdui-card mdui-container mdui-m-t-2">
			<div class="mdui-card-actions" id="path_bar">
			</div>
		</div>

		<div class="mdui-container doc-container mdui-p-t-4">
			<div class="mdui-row">
				<div class="mdui-card">
					<ul id="file-elements" class="mdui-list mdui-p-a-0" mdui-collapse="{accordion: true}">
					</ul>
				</div>
			</div>
		</div>
		<form id="uploadform" method="post" action="../api/uploadfile" enctype="multipart/form-data" hidden="hidden">
			<input id="current_path" type="text" name="current_path" />
			<input id="ichoose" type="file" name="uploadFile" />
		</form>
	</body>

</html>